//	Project:	HexTower
//	File:		Cursor.cpp
//	Author:		Mustafa Aldoori
//	Purpose:	Cursor Class implementation.

#include "Cursor.h"
#include "DirectGraphics_Manager.h"

CCursor* CCursor::GetInstance(void)
{
	static CCursor s_Instance;

	return &s_Instance;
}

CCursor::CCursor( void )
{
	CGame*	pGame = CGame::GetInstance();
	GetCursorPos(&m_lCursorPosition);
	ScreenToClient(pGame->GetWindowHandle(), &m_lCursorPosition);
	SetCursorRotationFloat( 0.0f );
	SetRenderBool( true );
}

CCursor::~CCursor( void )
{

}

void CCursor::Update( float felapsed )
{
	CGame*	pGame = CGame::GetInstance();
	GetCursorPos(&m_lCursorPosition);
	ScreenToClient(pGame->GetWindowHandle(), &m_lCursorPosition);
}

void CCursor::Render( void )
{
	if( GetRenderBool() == true )
	{
		DirectGraphics_Manager*	pGM = DirectGraphics_Manager::GetInstance();

		pGM->Draw( GetCursorImageID(), GetCursorXPosition(), GetCursorYPosition(),
			0.8f, 0.8f, nullptr, pGM->GetTextureWidth( GetCursorImageID() ) / 2.0f,
			pGM->GetTextureHeight( GetCursorImageID() ) / 2.0f, GetCursorRotation(),
			D3DCOLOR_ARGB( 200, 255, 255, 255 ) );
	}
}